package com.dsdl.chatapp.data;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by zzg on 2016/9/2.
 * 对应数据库表
 */
public class SocketMessage implements Parcelable {
    private int _id;
    private String ToUser;
    private String FromUser;
    private long CreateTime;
    private String MsgType;
    private String Command;
    private String Content;
    private String MsgId;
    private boolean showTime;//是否显示时间

    public int get_id() {
        return _id;
    }

    public void set_id(int _id) {
        this._id = _id;
    }

    public String getToUser() {
        return ToUser;
    }

    public void setToUser(String toUser) {
        ToUser = toUser;
    }

    public String getFromUser() {
        return FromUser;
    }

    public void setFromUser(String fromUser) {
        FromUser = fromUser;
    }

    public long getCreateTime() {
        return CreateTime;
    }

    public void setCreateTime(long createTime) {
        CreateTime = createTime;
    }

    public String getMsgType() {
        return MsgType;
    }

    public void setMsgType(String msgType) {
        MsgType = msgType;
    }

    public String getCommand() {
        return Command;
    }

    public void setCommand(String command) {
        Command = command;
    }

    public String getContent() {
        return Content;
    }

    public void setContent(String content) {
        Content = content;
    }

    public String getMsgId() {
        return MsgId;
    }

    public void setMsgId(String msgId) {
        MsgId = msgId;
    }

    public boolean isShowTime() {
        return showTime;
    }

    public void setShowTime(boolean showTime) {
        this.showTime = showTime;
    }

    public SocketMessage() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this._id);
        dest.writeString(this.ToUser);
        dest.writeString(this.FromUser);
        dest.writeLong(this.CreateTime);
        dest.writeString(this.MsgType);
        dest.writeString(this.Command);
        dest.writeString(this.Content);
        dest.writeString(this.MsgId);
        dest.writeByte(this.showTime ? (byte) 1 : (byte) 0);
    }

    protected SocketMessage(Parcel in) {
        this._id = in.readInt();
        this.ToUser = in.readString();
        this.FromUser = in.readString();
        this.CreateTime = in.readLong();
        this.MsgType = in.readString();
        this.Command = in.readString();
        this.Content = in.readString();
        this.MsgId = in.readString();
        this.showTime = in.readByte() != 0;
    }

    public static final Creator<SocketMessage> CREATOR = new Creator<SocketMessage>() {
        @Override
        public SocketMessage createFromParcel(Parcel source) {
            return new SocketMessage(source);
        }

        @Override
        public SocketMessage[] newArray(int size) {
            return new SocketMessage[size];
        }
    };
}
